﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Dotway.WPF.Controls">
    
    <Style TargetType="{x:Type local:ColorBar}">
        <Setter Property="ClipToBounds" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:ColorBar}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid>                            
                            <Canvas x:Name="PART_ColorPanel" />
                            <Path Fill="#FF000000" Stretch="Fill" Stroke="#FF000000" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,-5,0,0" Width="10" Height="10" Data="M0,0 L0,10 10,5 z" StrokeThickness="0">
                                <Path.RenderTransform>
                                    <TranslateTransform Y="{Binding Path=Position, RelativeSource={RelativeSource Mode=TemplatedParent}}" />
                                </Path.RenderTransform>
                            </Path>
                            <Path Fill="#FF000000" Stretch="Fill" Stroke="#FF000000" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,-5,0,0" Width="10" Height="10" Data="M10,0 L10,10 0,5 z" StrokeThickness="0">
                                <Path.RenderTransform>
                                    <TranslateTransform Y="{Binding Path=Position, RelativeSource={RelativeSource Mode=TemplatedParent}}" />
                                </Path.RenderTransform>
                            </Path>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type local:ColorBar}">
                            <Border Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}">
                                <Grid>
                                    <Canvas x:Name="PART_ColorPanel" />
                                    <Path Fill="#FF000000" Stretch="Fill" Stroke="#FF000000" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="-5,0,0,0" Width="10" Height="10" Data="M0,0 L10,0 5,10 z" StrokeThickness="0">
                                        <Path.RenderTransform>
                                            <TranslateTransform X="{Binding Path=Position, RelativeSource={RelativeSource Mode=TemplatedParent}}" />
                                        </Path.RenderTransform>
                                    </Path>
                                    <Path Fill="#FF000000" Stretch="Fill" Stroke="#FF000000" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="-5,0,0,0" Width="10" Height="10" Data="M0,10 L10,10 5,0 z" StrokeThickness="0">
                                        <Path.RenderTransform>
                                            <TranslateTransform X="{Binding Path=Position, RelativeSource={RelativeSource Mode=TemplatedParent}}" />
                                        </Path.RenderTransform>
                                    </Path>
                                </Grid>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>